var vm = new Vue({
  el: "#app",
  data: {
    loading: false,
    username: "",
    password: "",
  },
  mounted: function () {
    $("#toploading").hide();
  },
  methods: {    
    showOk(msg) {
      vant.Toast.success(msg);
    },
    showFail(msg) {
      vant.Toast.fail(msg);
    },
    async onSubmit() {
      this.loading = true;
      let res = await dalUser.login(this.username, this.password);
      this.loading = false;
      if (res.msg != "ok") {
        return this.showFail(res.msg);
      }
      this.showOk("登录成功！");
      window.location.href="./main.html"
    },
  },
});
